package org.javaboy.vhr.service;
/**
 * ClassName: CarManagerfService <br/>
 * Description: <br/>
 * date: 2020/3/21 20:55<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import org.javaboy.vhr.mapper.CarManagerMapper;
import org.javaboy.vhr.model.Car;
import org.javaboy.vhr.model.CarManager;
import org.javaboy.vhr.model.Manager;
import org.javaboy.vhr.model.RespPageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @program: vhr
 * @description:
 * @author: hesion
 * @create: 2020-03-21 20:55
 **/
@Service
public class CarManagerfService {
    @Autowired
    CarManagerMapper carManagerMapper;
    public RespPageBean getManagerByPage(Integer page, Integer size, Manager manager, Date[] beginDateScope) {
        if (page != null && size != null) {
            page = (page - 1) * size;
        }
        List<Manager> data = carManagerMapper.getManagerByPage(page, size,manager,beginDateScope);
        Long total = carManagerMapper.getTotal(manager, beginDateScope);
        RespPageBean bean = new RespPageBean();
        bean.setData(data);
        bean.setTotal(total);
        return bean;
    }

    public List<Manager> showCarManager(String cId) {
        return carManagerMapper.showCarManager(cId);
    }
}
